e844ac803ff48640e81e806731b159c9c3131173,src/net/java/sip/communicator/plugin/otr/ScOtrEngineImpl.java,ScOtrEngineImpl,generateKeyPair,#String#,400

Before Change


        String idPubKey;
        try
        {
            idPubKey =
                "net.java.sip.comunicator.plugin.otr."
                    + URLEncoder.encode(accountID, "UTF-8") + ".publicKey";
        }
        catch (UnsupportedEncodingException e1)
        {
            e1.printStackTrace();
            return;
        }
        PublicKey pubKey = keyPair.getPublic();
        X509EncodedKeySpec x509EncodedKeySpec =
            new X509EncodedKeySpec(pubKey.getEncoded());
        OtrActivator.configService.setProperty(idPubKey, new String(Base64
            .encode(x509EncodedKeySpec.getEncoded())));

        // Store Private Key.
        String idPrivKey;

After Change


        return new KeyPair(publicKey, privateKey);
    }

    public void generateKeyPair(String accountID)
    {
        KeyPair keyPair;
        try
        {
            keyPair = KeyPairGenerator.getInstance("DSA").genKeyPair();
        }
        catch (NoSuchAlgorithmException e)
        {
            e.printStackTrace();
            return;
        }

        // Store Public Key.
        PublicKey pubKey = keyPair.getPublic();
        X509EncodedKeySpec x509EncodedKeySpec =
            new X509EncodedKeySpec(pubKey.getEncoded());
        
        this.configurator.setProperty(accountID + ".publicKey", x509EncodedKeySpec.getEncoded());

        // Store Private Key.
        PrivateKey privKey = keyPair.getPrivate();